<?php

namespace backend\models;

use Yii;

/**
 * This is the model class for table "tme_unitinfo".
 *
 * @property integer $UnitID
 * @property string $Name
 * @property integer $Status
 * @property string $Remark
 *
 * @property TmeMerchandiseinfo[] $tmeMerchandiseinfos
 * @property TmeOrderdetailsinfo[] $tmeOrderdetailsinfos
 */
class TmeUnitinfo extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'tme_unitinfo';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['Name'], 'required'],
            [['Status'], 'integer'],
            [['Name'], 'string', 'max' => 20],
            [['Remark'], 'string', 'max' => 50]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'UnitID' => 'Unit ID',
            'Name' => 'Name',
            'Status' => 'Status',
            'Remark' => 'Remark',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getTmeMerchandiseinfos()
    {
        return $this->hasMany(TmeMerchandiseinfo::className(), ['UnitID' => 'UnitID']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getTmeOrderdetailsinfos()
    {
        return $this->hasMany(TmeOrderdetailsinfo::className(), ['UnitID' => 'UnitID']);
    }
}
